<template>
  <el-row class="creation-toolbar">
    <el-button v-for="btn of btns" :key="btn.text" @click="btnClick(btn)">{{btn.text}}</el-button>
  </el-row>
</template>

<script>
  export default {
    name: "qa-creation-toolbar",
    data() {
      return {
        btns: [
          { text: '提示/说明', code: 'paragraph' },
          { text: '文本框', code: 'input' ,data:{style:'text',placeholder:'点击输入'}},
          { text: '数字', code: 'input',data:{style:'number',placeholder:'输入数字'} },
          { text: '是/否', code: 'switch',data:{value:true} },
          { text: '日期/时间', code: 'datetime', data:{style:'datetime',placeholder:'请选择'}},
          { text: '单选题', code: 'radio',data:{style:'h'} },
          { text: '多选题', code: 'checkbox',data:{style:'h'} },
          { text: '图片', code: 'image',data:{defaultImage:'',imageDesc:''} },
          { text: '表格', code: 'table',data:{cols:[],rows:[]} },
        ]
      }
    },
    methods: {
      btnClick(btn) {
        this.$emit('newSection',{topic:btn.text,type:btn.code,data:btn.data})
      }
    }
  }
</script>

<style lang="scss">
  .creation-toolbar {
    .el-button {
      margin: 3px 3px;
      padding: 7px;
      border-radius: 0;
    }
  }
</style>
